package com.yneusoft.common.tool;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.LineCaptcha;
import cn.hutool.core.util.IdUtil;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class GraphicVerification {
    public static Map<String,String> CreatGraphicVerification(){
        /**
         * 生成图形验证码
         */
        LineCaptcha lineCaptcha = CaptchaUtil.createLineCaptcha(200,100);
        String uuid = IdUtil.randomUUID();
        String imageCodeBase64 = lineCaptcha.getImageBase64();
        String imageCode = lineCaptcha.getCode();
        Map<String,String> map = new HashMap<>();
        map.put("imageCode",imageCode);
        map.put("uuid",uuid);
        map.put("imageCodeBase64", imageCodeBase64);
        return map;
    }
}
